﻿using Flurl.Http;
using Flurl.Http.Configuration;
using MXERP.Shared.Constants;
using MXERP.Shared.Wrapper;

namespace MXERP.Infrastructure.Managers
{
    public class AppManager : IAppManager
    {
        private readonly IFlurlClient _flurlClient;
        public AppManager(IFlurlClientCache clients)
        {
            _flurlClient = clients.Get(ApiConstant.MXERP);
        }
        public async Task<ApiResponse<List<AppResponse>>> Query()
        {
            var result = await _flurlClient.Request(EndpointConstant.App.Query).GetAsync().ReceiveJson<ApiResponse<List<AppResponse>>>();
            return result;
        }
        public async Task<ApiResponse<List<AppResponse>>> GetCurrentUserApps()
        {
            var result = await _flurlClient.Request(EndpointConstant.App.GetCurrentUserApps).GetAsync().ReceiveJson<ApiResponse<List<AppResponse>>>();
            return result;
        }
    }
}
